package com.itheima.d1_collection_set;

import java.util.HashSet;

/*
     目标：自定义的类型的对象，比如两个内容一样的学生对象，如果让HashSet集合能够去重复！
 */
public class SetTest3 {
    public static void main(String[] args) {
        HashSet<Student> stus = new HashSet<>();
        stus.add(new Student("小明", 18));
        stus.add(new Student("小明", 18));
        stus.add(new Student("小去", 122));
        stus.add(new Student("小的", 11));
        for (Student student : stus) {
            System.out.println(student.getName()+ ":"+ student.getAge());
        }
    }
}
